<?php
namespace app\common\validate;

use think\Validate;

class ShopValidate extends Validate{

    protected $rule = [
        'name'=>'require',    //名称可以相同 因为有分组
        'address'=>'require',
        'cover'=>'require',
        'mobile'=>'require|regex:\d{11}',
        'cat'=>'number',
    ];

    protected $message = [
        'name.require'=>'商家名字必填',
        'address.require'=>'请填写地址',
        'cover.require'=>'请上传封面',
        'mobile.require'=>'请填写联系方式',
        'mobile.regex'=>'联系方式为11位手机号码'
    ];

    protected $scene = [
        'add' => ['name','address','cover','mobile','cat'],
        'edit' => ['name','address','cover','mobile','cat'],
    ];
}